<?php
namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Realname;
use App\FeeConf;
/**
 * 手续费，费率配置
 *
 */
class FeeController extends AdminController
{

    public function feeconfig(Request $request)
    {
        $fee = FeeConf::where('id', 1)->first();
        if (! $fee) {
            $fee = new FeeConf();
            $fee->save();
            $fee = FeeConf::where('id', 1)->first();
        }
        $attrs = array(
            "fee",
            "fee_3",
            "fee_6",
            "fee_9",
            "fee_12",
            "fee_24",
            "fee_36",
            "fee_before"
        );
        foreach ($attrs as $key) {
            $v = trim($request->input($key, ''));
            if ($v) {
                $fee->$key = $v;
            }
        }
        $fee->save();
        
        $this->output($fee);
    }
}